package jtk.project4.fleet.field;

import java.awt.Dimension;

import javax.swing.SortOrder;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;

public class TireHistory1Field extends GroupControl<String>{
	private TableField<String> TireHistoryTable;
	
	public TireHistory1Field(String bindID){
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields(){
		//setup table
		TireHistoryTable = new TableField<String>("TireHistoryTable","TireHistoryTable");
		//TireHistoryTable.setTitle("TireHistory.header.table");
		TireHistoryTable.setAutoResizeMode(AutoResizeMode.OFF);
		TireHistoryTable.setPreferredSize(new Dimension(800,500));
		TireHistoryTable.getSelectionValues();
		
		//add columns
		TireHistoryTable.addColumn("label.date","date");
		TireHistoryTable.addColumn("label.serialNO","serialNO");
		TireHistoryTable.addColumn("label.equipment","equipment");
		TireHistoryTable.addColumn("label.axle","axle");
		TireHistoryTable.addColumn("label.position","position");
		TireHistoryTable.addColumn("label.type","type");
		TireHistoryTable.addColumn("label.meter","meter");
		TireHistoryTable.addColumn("label.treadDepth","treadDepth");
		TireHistoryTable.addColumn("label.preassure","preassure");
		TireHistoryTable.addColumn("label.cost","cost");
		TireHistoryTable.addColumn("label.costCenter","costCenter");
		TireHistoryTable.addColumn("label.comments","comments");
		//sort
		TireHistoryTable.sort("noPart", SortOrder.ASCENDING);
	}
	
	private void createLayout() {
		setLayout(new FormLayout())
		.addField(TireHistoryTable)
		.addRow()
		;
	}
}